package com.springboot.user.Interceptor;

import com.springboot.framework.jwt.TokenInterceptor;
import com.springboot.framework.jwt.TokenServiceResolver;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 定义用户模块的 token登录拦截器
 */

public class UserTokenInterceptor extends TokenInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        return super.preHandle(request, response, handler, new TokenServiceResolver() {
            @Override
            public boolean doService(String userMark) {
                /* 根据从token取出来的用户标识做业务处理,返回true为通过token验证 */
                return false;
            }
        });
    }

}
